{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

<KvPageHeader @breadcrumbs={{@breadcrumbs}} @pageTitle={{@path}}>
  <:tabLinks>
    <LinkTo @route="secret.details" data-test-secrets-tab="Secret">Secret</LinkTo>
    <LinkTo @route="secret.metadata.index" data-test-secrets-tab="Metadata">Metadata</LinkTo>
    <LinkTo @route="secret.paths" data-test-secrets-tab="Paths">Paths</LinkTo>
    {{#if @canReadMetadata}}
      <LinkTo @route="secret.metadata.versions" data-test-secrets-tab="Version History">Version History</LinkTo>
    {{/if}}
  </:tabLinks>
</KvPageHeader>

<h2 class="title is-5 has-top-margin-xl">
  Paths
</h2>

<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
  {{#each this.paths as |path|}}
    <InfoTableRow @label={{path.label}} @labelWidth="is-one-third" @helperText={{path.text}} @truncateValue={{true}}>
      <Hds::Copy::Button
        @text="Copy"
        @isIconOnly={{true}}
        @textToCopy={{path.snippet}}
        data-test-copy-button={{path.snippet}}
        class="transparent"
      />
      <code class="is-flex-1 text-overflow-ellipsis has-left-margin-s">
        {{path.snippet}}
      </code>
    </InfoTableRow>
  {{/each}}
</div>

<h2 class="title is-5 has-top-margin-xl">
  Commands
</h2>

<div class="box is-fullwidth is-sideless">
  <h3 class="is-label">
    CLI
    <Hds::Badge @text="kv get" @color="neutral" />
  </h3>
  <p class="helper-text has-text-grey has-bottom-padding-s">
    This command retrieves the value from KV secrets engine at the given key name. For other CLI commands,
    <DocLink @path="/vault/docs/commands/kv">
      learn more.
    </DocLink>
  </p>
  <CodeSnippet data-test-commands="cli" @codeBlock={{this.commands.cli}} />

  <h3 class="has-top-margin-l is-label">
    API read secret version
  </h3>
  <p class="helper-text has-text-grey has-bottom-padding-s">
    This command obtains data and metadata for the latest version of this secret. In this example, Vault is located at
    https://127.0.0.1:8200. For other API commands,
    <DocLink @path="/vault/api-docs/secret/kv/kv-v2">
      learn more.
    </DocLink>
  </p>
  <CodeSnippet data-test-commands="api" @clipboardCode={{this.commands.apiCopy}} @codeBlock={{this.commands.apiDisplay}} />
</div>